package com.brady.springbootdemo.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("demo")
public class DemoController {

    private final RestTemplate restTemplate;

    @Autowired
    public DemoController(RestTemplate restTemplate) {this.restTemplate = restTemplate;}


    @Value(value = "${test.Val}")
    private String testVal;

    @Value(value = "${aaa.bbb}")
    private String test2Val;



    @RequestMapping("hello")
    public String hello() {
        StringBuilder sb = new StringBuilder();
        sb.append("hello world");
        sb.append("\ntestVal: ").append(testVal);
        sb.append("\ntest2Val: ").append(test2Val);

        return sb.toString();
    }
}
